package com.mazaiting.rabbitmq.config;

import lombok.Data;
import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * 消息配置
 *
 * @author mazaiting
 * @create_time 2022/10/3 12:00
 */
@Data
@Configuration
@ConfigurationProperties("mq")
public class MqProperties {

    /**
     * 确认模式, 默认是手动确认
     */
    private AcknowledgeMode ackMode = AcknowledgeMode.MANUAL;

    /**
     * 锁的最大释放时间. 默认 = 30s
     * @see org.redisson.RedissonLock#internalLockLeaseTime
     */
    private Integer leaseTime;

    /**
     * 消息发送者发送的数量, 默认 = 5
     */
    private Integer prefetchCount = 5;

    /**
     * 为每个队列添加多个消费者 增加并行度, 默认 = 5
     */
    private Integer consumersPerQueue = 5;

    /**
     * 最大重试次数, 默认 = 3
     */
    private Integer maxAttempts = 3;
}
